Before we start with this exercise, two short notes on working with the exercise files in this workshop:
We would like to ask you to solve all coding tasks by writing them into your own R script files. This ensures that all of your solutions are reproducible, and that you can (re-)use solutions from earlier exercises in later ones.
All exercises and their solutions ‘assume’ they are in the solutions folder within the folder that contains the materials for this course. This way they can make use of files in other folders using relative paths. In order for your scripts to run properly, we suggest that you create (and save) them either in the my_scripts folder (which already includes an almost empty script that you can continue to work with) or either the exercises or solutions folder. For the relative file paths to work, you will also need to set your working directory to the folder that contains the script (check the slides again, if you need a reminder who to do that). Otherwise, you may have to change the (relative) file paths accordingly.
Now let’s get to it…
To explore what R packages are out there that may be of interest for you, have a look at the CRAN Task View section called SocialSciences and do a quick search for “regression” on METACRAN. Although it may be tempting (there are so many interesting packages!), try not to spend more than 2 to 3 minutes on this (for now).
CRAN (we will use those later on in the course). Please install the following packages: devtools, tidyverse, naniar, correlation (Note: We will need a few more packages throughout this course, but we do not have to install all of them now).
devtools package.
CRAN. Another important source of R packages is GitHub (especially for development versions). So, let’s install a package from there. Install the emo package from GitHub. NB: To be able to install packages from GitHub on Windows machines, you will need to install Rtools first.
install_github() function from the devtools package for this.
Feel free to save your changes when you’re done.
correlation package.
Before you really start working with RStudio, we also recommend changing the settings under Tools -> Global Options -> General, so that the workspace is never automatically saved and restored, and the history is not always saved.
Finally, to make your new favorite work environment prettier, choose a theme for RStudio. You can do this via Tools -> Global Options -> Appearance in the RStudio menu.